# This file marks a workspace root for the Bazel build system.
# See `https://bazel.build/`.

# This file lists Drake's external dependencies as known to bzlmod. It is used
# in concert with WORKSPACE.bzlmod (which has the workspace-style externals).

module(
    name = "drake",
    # This version number should match MINIMUM_BAZEL_VERSION in CMakeLists.txt.
    bazel_compatibility = [">=7.4.1"],
)

# Add starlark rules.

bazel_dep(name = "apple_support", version = "1.17.1", repo_name = "build_bazel_apple_support")  # noqa
bazel_dep(name = "bazel_features", version = "1.22.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "rules_java", version = "8.6.1")
bazel_dep(name = "rules_license", version = "1.0.0")
bazel_dep(name = "rules_python", version = "0.40.0")
bazel_dep(name = "rules_rust", version = "0.56.0")
bazel_dep(name = "rules_shell", version = "0.3.0")

# Customize our toolchains.

cc_configure = use_extension(
    "@rules_cc//cc:extensions.bzl",
    "cc_configure_extension",
)
use_repo(cc_configure, "local_config_cc")

# Add C++ dependencies that are part of our public API.
#
# We declare these dependencies twice -- as modules (bazel_dep) and repository
# rules (pkgconfig). The choice of whether module vs pkgconfig will be used is
# governed by the flags declared at drake/tools/flags/BUILD.bazel.
#
# For our CMake builds from source, the "WITH_USER_..." CMake options to choose
# the flavor are translated into the matching Bazel flags.
#
# For wheel builds, the module flavor is always used.
#
# For Bazel builds using Drake as an external, the module flavor is used by
# default but can be changed using the Bazel flags.
#
# For first-party Bazel builds (by Drake Developers), the pkgconfig flavor is
# used by default but can be changed using the Bazel flags.

bazel_dep(name = "eigen", version = "3.4.0.bcr.2", repo_name = "module_eigen")
bazel_dep(name = "fmt", version = "11.0.2.bcr.1", repo_name = "module_fmt")
bazel_dep(name = "spdlog", version = "1.15.0.bcr.4", repo_name = "module_spdlog")  # noqa

eigen_repository = use_repo_rule(
    "@drake//tools/workspace/eigen:repository.bzl",
    "eigen_repository",
)

eigen_repository(name = "pkgconfig_eigen")

fmt_repository = use_repo_rule(
    "@drake//tools/workspace/fmt:repository.bzl",
    "fmt_repository",
)

fmt_repository(name = "pkgconfig_fmt")

spdlog_repository = use_repo_rule(
    "@drake//tools/workspace/spdlog:repository.bzl",
    "spdlog_repository",
)

spdlog_repository(name = "pkgconfig_spdlog")

# Add C++ module dependencies that are NOT used by Drake's public API, but are
# used by Drake's implementation. Builds have the option to opt-out of these
# depdencies by providing a replacement:
#
# For our CMake builds from source, the "WITH_USER_..." CMake options find a
# user-supplied library are converted into a module override.
#
# For wheel builds, the module flavor is always used.
#
# For Bazel builds using Drake as an external, the module flavor is used by
# default but can be changed using the Bazel flags at @drake//tools/flags.
# For first-party Bazel builds (by Drake Developers), the non-module flavor
# is used by default.

bazel_dep(name = "zlib", version = "1.3.1.bcr.4", repo_name = "module_zlib")

# TODO(jwnimmer-tri) These as well should be module-or-external.
# - glib

# Add additional modules we use as tools (not runtime dependencies).

bazel_dep(name = "toolchains_llvm", version = "1.4.0")

llvm = use_repo_rule("@toolchains_llvm//toolchain:rules.bzl", "llvm")

llvm(
    name = "llvm",
    llvm_version = "19.1.3",
)

# Load dependencies which are "public", i.e., made available to downstream
# projects.
#
# Downstream projects may load the same `drake_dep_repositories` module
# extension shown below and call its `use_repo` with whatever list of
# repositories they desire to cite from their project. It's safe to call
# `use_repo` on a subset of this list, or not call it at all downstream.
# Its only effect on a downstream project is to make the repository name
# visible to BUILD rules; Drake's own use of the repository is unaffected.

drake_dep_repositories = use_extension(
    "@drake//tools/workspace:default.bzl",
    "drake_dep_repositories",
)
use_repo(
    drake_dep_repositories,
    "blas",
    "buildifier",
    "drake_models",
    "eigen",
    "fmt",
    "gflags",
    "glib",
    "gtest",
    "gurobi",
    "lapack",
    "lcm",
    "meshcat",
    "mosek",
    "opencl",
    "pybind11",
    "pycodestyle",
    "python",
    "snopt",
    "spdlog",
    "styleguide",
    "x11",
    "zlib",
)

# Load dependencies which are "private", i.e., not available for use by
# downstream projects. These are all "internal use only".
#
# TODO(jwnimmer-tri) By historical accident, not all of the repository names
# here end with "internal". We should work on improving the consistency, either
# by switching them to use BCR modules instead (e.g., nasm) or renaming them
# to internal (e.g., statsjs). Specifics are listed inline below. For renaming,
# we'll wait until after the WORKSPACE deprecation is done (2025-09-01) so that
# users can naturally stop using them during their bzlmod porting process and
# we won't need to provide any additional temporary infrastructure.

internal_repositories = use_extension(
    "@drake//tools/workspace:default.bzl",
    "internal_repositories",
)
use_repo(
    internal_repositories,
    "abseil_cpp_internal",
    "bazelisk",  # TODO(jwnimmer-tri) Mark as internal.
    "ccd_internal",
    "clang_cindex_python3_internal",
    "clarabel_cpp_internal",
    "clp_internal",
    "coinutils_internal",
    "com_jidesoft_jide_oss",  # TODO(jwnimmer-tri) Mark as internal.
    "common_robotics_utilities_internal",
    "commons_io",  # TODO(jwnimmer-tri) Mark as internal.
    "csdp_internal",
    "curl_internal",
    "dm_control_internal",
    "doxygen",  # TODO(jwnimmer-tri) Mark as internal.
    "fcl_internal",
    "gfortran",  # TODO(jwnimmer-tri) Mark as internal.
    "github3_py_internal",
    "gklib_internal",
    "googlebenchmark",  # TODO(jwnimmer-tri) Switch to module.
    "gymnasium_py",  # TODO(jwnimmer-tri) Mark as internal.
    "gz_math_internal",
    "gz_utils_internal",
    "highway_internal",
    "ipopt_internal",
    "lapack_internal",
    "libjpeg_turbo_internal",
    "libpng_internal",
    "libtiff_internal",
    "metis_internal",
    "mpmath_py_internal",
    "msgpack_internal",
    "mujoco_menagerie_internal",
    "mumps_internal",
    "mypy_extensions_internal",
    "mypy_internal",
    "nanoflann_internal",
    "nasm",  # TODO(jwnimmer-tri) Switch to module.
    "net_sf_jchart2d",  # TODO(jwnimmer-tri) Mark as internal.
    "nlohmann_internal",
    "nlopt_internal",
    "onetbb_internal",
    "openusd_internal",
    "org_apache_xmlgraphics_commons",  # TODO(jwnimmer-tri) Mark as internal.
    "osqp_internal",
    "picosha2_internal",
    "pkgconfig_blas_internal",
    "pkgconfig_lapack_internal",
    "poisson_disk_sampling_internal",
    "qdldl_internal",
    "qhull_internal",
    "ros_xacro_internal",
    "rules_python_drake_constants",  # TODO(jwnimmer-tri) Remove 2025-09-01.
    "scs_internal",
    "sdformat_internal",
    "spgrid_internal",
    "spral_internal",
    "stable_baselines3_internal",
    "statsjs",  # TODO(jwnimmer-tri) Mark as internal.
    "stduuid_internal",
    "suitesparse_internal",
    "sympy_py_internal",
    "tinygltf_internal",
    "tinyobjloader_internal",
    "tinyxml2_internal",
    "tomli_internal",
    "typing_extensions_internal",
    "uritemplate_py_internal",
    "usockets_internal",
    "uwebsockets_internal",
    "voxelized_geometry_tools_internal",
    "vtk_internal",
    "xmlrunner_py",  # TODO(jwnimmer-tri) Mark as internal.
    "yaml_cpp_internal",
)

internal_crate_universe_repositories = use_extension(
    "//tools/workspace:default.bzl",
    "internal_crate_universe_repositories",
)
use_repo(
    internal_crate_universe_repositories,
    "crate__amd-0.2.2",
    "crate__autocfg-1.4.0",
    "crate__blas-0.22.0",
    "crate__blas-sys-0.7.1",
    "crate__bumpalo-3.17.0",
    "crate__cfg-if-1.0.0",
    "crate__clarabel-0.10.0",
    "crate__darling-0.14.4",
    "crate__darling_core-0.14.4",
    "crate__darling_macro-0.14.4",
    "crate__derive_builder-0.11.2",
    "crate__derive_builder_core-0.11.2",
    "crate__derive_builder_macro-0.11.2",
    "crate__either-1.15.0",
    "crate__enum_dispatch-0.3.13",
    "crate__equivalent-1.0.2",
    "crate__fnv-1.0.7",
    "crate__hashbrown-0.15.2",
    "crate__ident_case-1.0.1",
    "crate__indexmap-2.8.0",
    "crate__itertools-0.11.0",
    "crate__itoa-1.0.15",
    "crate__js-sys-0.3.77",
    "crate__lapack-0.19.0",
    "crate__lapack-sys-0.14.0",
    "crate__lazy_static-1.5.0",
    "crate__libc-0.2.171",
    "crate__log-0.4.27",
    "crate__memchr-2.7.4",
    "crate__num-complex-0.4.6",
    "crate__num-traits-0.2.19",
    "crate__once_cell-1.19.0",
    "crate__paste-1.0.15",
    "crate__proc-macro2-1.0.94",
    "crate__quote-1.0.40",
    "crate__ryu-1.0.20",
    "crate__serde-1.0.219",
    "crate__serde_derive-1.0.219",
    "crate__serde_json-1.0.140",
    "crate__strsim-0.10.0",
    "crate__syn-1.0.109",
    "crate__syn-2.0.100",
    "crate__thiserror-1.0.69",
    "crate__thiserror-impl-1.0.69",
    "crate__unicode-ident-1.0.18",
    "crate__wasm-bindgen-0.2.100",
    "crate__wasm-bindgen-backend-0.2.100",
    "crate__wasm-bindgen-macro-0.2.100",
    "crate__wasm-bindgen-macro-support-0.2.100",
    "crate__wasm-bindgen-shared-0.2.100",
    "crate__web-time-0.2.4",
)
